﻿Imports KOR.Helpers

Namespace BL

    Public Module PriceRanges

#Region "PriceRanges_DML"
        Public Function InsertPriceRange(dict As Dictionary(Of String, Object)) As Integer
            Return DDA.Insert("PriceRanges", dict)
        End Function

        Public Function UpdatePriceRange(dict As Dictionary(Of String, Object), PriceRangeID As Integer) As Integer
            Return DDA.Update("PriceRanges", dict, "PriceRangeID=" & PriceRangeID)
        End Function

        Public Function DeletePriceRange(ByVal PriceRangeID As Integer) As Integer
            Return DDA.Delete("PriceRanges", "PriceRangeID=" & PriceRangeID, False)
        End Function
#End Region

#Region "PriceRanges_Selection"
        Public Function GetAllPriceRanges() As IDataReader
            Dim sql As String = "SELECT * FROM PriceRanges Order By PriceRangeID DESC"
            Return DDA.SelectData(sql)
        End Function

        Public Function GetPriceRanges(searchFor As String, criteria As String, startRowIndex As Integer, maximumRows As Integer, SortBy As String) As IDataReader
            Dim sql As String
            sql = "SELECT * FROM PriceRanges "

            If SortBy = "" Then SortBy = " CreatedDate Desc"

            Return DDA.SelectDataPaginated(sql, startRowIndex, maximumRows, SortBy)
        End Function

        Public Function PriceRangesCount(searchFor As String, criteria As String) As Integer
            Dim sql As String
            sql = "SELECT * FROM PriceRanges "
            Return DDA.SelectDataCount(sql)
        End Function
#End Region

    End Module
End Namespace